<template>
  <div class="image-display">
    <div class="image-container">
      <img :src="imageSrc" :alt="altText" class="display-image" v-if="imageSrc">
      <div class="no-image" v-else>
        <i class="el-icon-picture-outline"></i>
        <p>{{ noImageText }}</p>
      </div>
    </div>
    <div class="image-caption" v-if="caption">{{ caption }}</div>
  </div>
</template>

<script>
export default {
  name: 'ImageDisplay',
  props: {
    imageSrc: {
      type: String,
      default: ''
    },
    altText: {
      type: String,
      default: '图片'
    },
    caption: {
      type: String,
      default: ''
    },
    noImageText: {
      type: String,
      default: '暂无图片'
    }
  }
}
</script>

<style scoped>
.image-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 15px;
}

.image-container {
  width: 100%;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  background-color: #f5f7fa;
}

.display-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.no-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #909399;
}

.no-image i {
  font-size: 48px;
  margin-bottom: 10px;
}

.image-caption {
  margin-top: 8px;
  font-size: 14px;
  color: #606266;
  text-align: center;
}
</style> 